import logging
from logs import ResultFolder

logger = logging.getLogger()
logger.setLevel(logging.DEBUG)

def CreateLoggerFile(filename):
	try:
		fulllogname = ResultFolder.GetRunDirectory()+'\\logs' + "\\"+filename+".log"
		fh = logging.FileHandler(fulllogname)
		fh.setLevel(logging.DEBUG)
		formatter = logging.Formatter('%(asctime)s [line:%(lineno)d] %(message)s')
		fh.setFormatter(formatter)
		logger.addHandler(fh)
	except Exception as err:
		logger.debug("Error when creating log file, error message:{}".format(str(err)))

def Log(message):
	logger.debug(message)
'''
if __name__ == '__main__':
	print(ResultFolder.GetRunDirectory())
	# CreateLoggerFile('mylog')
	#Log('create message')
	#Log('End message')
'''